home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 April / EnigmA AMIGA RUN 17 (1997)(G.R. Edizioni)(IT)[!][issue 1997-04][EAR-CD].iso / EARCD / text / edit / envwrd41.lha / envWRD41 / source / words / sprintf.a < prev    next >
Text File  |  1994-09-25  |  763b  |  39 lines

  1. ;
  2. ; Simple version of the C "sprintf" function.  Assumes C-style
  3. ; stack-based function conventions.
  4. ;
  5. ;   long eyecount;
  6. ;   eyecount=2;
  7. ;   sprintf(string,"%s have %ld eyes.","Fish",eyecount);
  8. ;
  9. ; would produce "Fish have 2 eyes." in the string buffer.
  10. ;
  11.         xdef _myprintf
  12.         xref _SysBase
  13.         xref _LVORawDoFmt
  14.  
  15.         SECTION sprintf,CODE
  16.  
  17. _myprintf:
  18.         movem.l a2/a3/a6,-(sp)
  19.  
  20.         move.l  16(sp),a3
  21.         move.l  20(sp),a0
  22.         lea.l   24(sp),a1
  23.         lea.l   stuffChar(pc),a2
  24.         move.l  _SysBase,a6
  25.         jsr     _LVORawDoFmt(a6)
  26.  
  27.         movem.l (sp)+,a2/a3/a6
  28.         move.l  4(sp),d0
  29.         rts
  30.  
  31. ;------ PutChProc function used by RawDoFmt -----------
  32.  
  33. stuffChar:
  34.  
  35.         move.b  d0,(a3)+
  36.         rts
  37.  
  38.         END
  39.